package com.b2j.language;

import com.b2j.base.Lexema;
import com.b2j.base.MainTools;
import com.b2j.base.Routine;
import com.b2j.base.Token;

public class For extends Routine {

	@Override
	public String generate(Lexema lexema) {
		
		String line = "for(";
		lexema = MainTools.tools.nextLexema();
			
		// Process the FOR body 'for(initialization;condition;increment)'
		line = line + MainTools.tools.processCodeUntil(lexema, Token.CPARENT);
		line = line + "){\n";
		
		// Process the code inside the block of FOR
		line = line + MainTools.tools.processCodeUntil(lexema, Token.END);
		line = line + "}\n";
			
		return line;
	}

}
